<?php

namespace Account\Model;

use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterInterface;

class Account
{
    public $account_id, $bank_id, $bank_name, $account_balance, $rate, $overdraft;
    protected $inputFilter;

    public function exchangeArray($data)
    {
        foreach ($this as $key => $val) {
            $this->$key = empty($data[$key]) ? null : $data[$key];
        }
//        $this->account_id = (!empty($data['account_id'])) ? $data['account_id'] : null;
//        $this->bank_id = (!empty($data['bank_id'])) ? $data['bank_id'] : null;
//        $this->bank_name = (!empty($data['bank_name'])) ? $data['bank_name'] : null;
//        $this->account_balance = (!empty($data['account_balance'])) ? $data['account_balance'] : null;
//        $this->rate = (!empty($data['rate'])) ? $data['rate'] : null;
//        $this->overdraft = (!empty($data['overdraft'])) ? $data['overdraft'] : null;
    }

    public function getArrayCopy()
    {
        return get_object_vars($this);
    }

    public function setInputFilter(InputFilterInterface $inputFilter)
    {
        throw new \Exception('Not used');
    }

    public function getInputFilter()
    {
        if (!$this->inputFilter) {
            $this->inputFilter = new InputFilter();
        }
        return $this->inputFilter;
    }
}